<?php
if (!defined('BASEPATH'))
    exit('no direct script allowed asshole!!');
$this->load->helper('html');
?>



<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/jscal2.js"></script>
<script src="<?= base_url() ?>js/lang/en.js"></script>

<!-- CSS -->
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/steel/steel.css" />

 

<div id="container">
    <fieldset class="fieldset">
        <legend class="legend">

		|Form Biodata Santri|</legend>

        <div id="contentform" style="border:solid thin #BBBBBB; height:350px; background-color:#F9F9F9; -moz-border-radius: 5px;  padding-top:10px; padding-bottom:0.3px; margin-right:100px; margin-left:100px;">

            <!-- Start value -->
            <?
            //Setting Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
            $value = array(
                'id_santri' => "",
                'munakosah' => "",//$munakosah,
                'nama_santri' => "",
                'asal_santri' => "",
                'kecamatan' => "",
                'kota' => "",
                'telpon_santri' => "",
				'tempat_lahir' => "",
				'tanggal_lahir' => "",
				'id_status' => "",
				'id_pendidikan' => "",
				'pekerjaan_santri' => "",
				'instansi' => "",
				'jabatan' => "",
				'alamat_perusahaan' => "",
				'tanggal_pendaftaran' => "",
                'foto_santri' => "",
				'id_jk' => "",
				'act_form' => "santri/upload/"
            );
			
            //Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
            if ($status == "edit") {
                $value['id_santri'] = $id_santri;
                $value['munakosah'] = $munakosah;
                $value['nama_santri'] = $nama_santri;
                $value['asal_santri'] = $asal_santri;
                $value['kecamatan'] = $kecamatan;
                $value['kota'] = $kota;
                $value['telpon_santri'] = $telpon_santri;
				$value['tempat_lahir'] = $tempat_lahir;
				$value['tanggal_lahir'] = $tanggal_lahir;
				$value['id_jk'] = $id_jk;
				$value['id_status'] = $id_status;
				$value['id_pendidikan'] = $id_pendidikan;
				$value['pekerjaan_santri'] = $pekerjaan_santri;
				$value['instansi'] = $instansi;
				$value['jabatan'] = $jabatan;
				$value['alamat_perusahaan'] = $alamat_perusahaan;
				$value['tanggal_pendaftaran'] = $tanggal_pendaftaran;
                $value['foto_santri'] = $foto_santri;
				$value['id_jk'] = $id_jk;
				$value['act_form'] = "santri/update/" . $value['id_santri'];
            }//end if
            ?>

            <?= form_open_multipart($value["act_form"]); ?>
           
            <!-- End value -->

            <table width="847" border="0" bordercolor="#F0F0F0">
                <tr>
                    <td width="905" height="150">
                        <form id="form1" name="form1" method="post">
                            <div align="center">
                                <table width="850" border="0">
                                    
									<tr>
                                    <? if ($status == "edit") {echo ' <td width="80">No. Induk</td> 
                                        <td width="208"> <input name="munakosah" disabled="true" type="text" size="50" value="';} else '';?> <?= $value['munakosah']; if ($status == "edit") { echo'"/></td>
                                    </tr>
                                    ';} else '';?>
									
									<tr>
                                        <td width="80">Nama Santri</td>
                                        <td width="208"><input name="nama_santri" type="text" size="50" value="<?= $value['nama_santri'] ?>"/></td>
                                        <td><? echo form_error('nama_santri');?></td>
                                    </tr>
                                    <tr>
                                        <td width="80">Alamat</td>
                                        <td> <textarea  id="asal_santri" name="asal_santri" ><?= $value['asal_santri'] ?></textarea></td>
                                        <td><? echo form_error('asal_santri');?></td>
									</tr>
									
                                    <tr>
                                        <td width="80">Kecamatan</td>
                                        <td width="208"><input name="kecamatan" type="text" size="50" value="<?= $value['kecamatan'] ?>"/></td>
										<td><? echo form_error('kecamatan');?></td>
									</tr>
                                    <tr>
                                        <td width="80">Kota</td>
                                        <td width="208"><input name="kota" type="text" size="50" value="<?= $value['kota'] ?>"/></td>
										<td><? echo form_error('kota');?></td>
									</tr>
									<tr>
                                        <td width="80">Telpon/HP</td>
                                        <td width="208"><input name="telpon_santri" type="text" size="50" value="<?= $value['telpon_santri'] ?>"/></td>
										<td><? echo form_error('telpon_santri');?></td>
									</tr>
									<tr>
                                        <td width="80">Tempat Lahir</td>
                                        <td width="208"><input name="tempat_lahir" type="text" size="50" value="<?= $value['tempat_lahir'] ?>"/></td>
										<td><? echo form_error('tempat_lahir');?></td>
									</tr>
									<tr>
                                        <td width="80">Tanggal Lahir</td>
                                        <td width="108"><input id="tanggal_lahir" name="tanggal_lahir" readonly="true" size="20" value="<?= $value['tanggal_lahir'] ?>"/><input id="f_btn1" type="button" name="Submit22" value="" onclick="tanggal_lahir.value=''"/></td>
										<td><? echo form_error('tanggal_lahir');?></td>
									</tr>
									<tr>
                                        <td width="80">Jenis Kelamin</td>
										 <td width="208">
										<?php 
											$pilihan_jk = array(
											Null => '-- Pilih Jenis Kelamin --',
											'Laki-Laki' => 'Laki - Laki',
											'Perempuan' => 'Perempuan'
											);
											
											if ($status == "edit"){
											echo form_dropdown('id_jk',$pilihan_jk,$id_jk, 'class="field select"');
										}
										else {
										echo form_dropdown('id_jk',$pilihan_jk,  'class="field select"');
										}
										
										?>
										</td>
										<td><? echo form_error('id_jk');?></td>
									</tr>
									
									<tr>
                                        <td width="80">Status</td>
                                       <td width="208">
										<?php 
											$pilihan_status = array(
											Null => '-- Pilih Status --',
											'Berkeluarga' => 'Berkeluarga',
											'Bujang' => 'Bujang',
											'Janda' => 'Janda',
											'Duda' => 'Duda',
											'Lain-lain' => 'Lain - lain'
											);
											
											if ($status == "edit"){
											echo form_dropdown('id_status',$pilihan_status,$id_status,'class="field select"');
										}
										else {
										echo form_dropdown('id_status',$pilihan_status,'class="field select"');
										
										}
										?>
										</td>
										<td><? echo form_error('id_status');?></td>
									</tr>
										
									<tr>
                                    <td width="80">Pendidikan</td>
                                        <td width="208">
										<?php 
											$pilihan_pendidikan = array(
											Null => '-- Pilih Pendidikan --',
											'SLTP' => 'SLTP',
											'SLTA' => 'SLTA',
											'Diploma' => 'Diploma',
											'S1' => 'S1',
											'S2' => 'S2',
											'S3' => 'S3',
											'Lain-lain' => 'Lain - lain'
											);
											
											if($status=="edit"){
											echo form_dropdown('id_pendidikan',$pilihan_pendidikan,$id_pendidikan,'class="field select"');
										}
										else {
										echo form_dropdown('id_pendidikan',$pilihan_pendidikan,'class="field select"');
										
										}
										?>
										</td>
										<td><? echo form_error('id_pendidikan');?></td>
										
									</tr>
									
									<tr>
                                        <td width="80">Pekerjaan</td>
                                        <td width="208"><input name="pekerjaan_santri" type="text" size="50" value="<?= $value['pekerjaan_santri'] ?>"/></td>
										<td><? echo form_error('pekerjaan_santri');?></td>
									</tr>
									<tr>
                                        <td width="80">Instansi / Perusahaan</td>
                                        <td width="208"><input name="instansi" type="text" size="50" value="<?= $value['instansi'] ?>"/></td>
									</tr>
									<tr>
                                        <td width="80">Jabatan</td>
                                        <td width="208"><input name="jabatan" type="text" size="50" value="<?= $value['jabatan'] ?>"/></td>
                                    </tr>
									<tr>
                                        <td width="80">Alamat Perusahaan</td>
                                        <td> <textarea  id="alamat_perusahaan" name="alamat_perusahaan" ><?= $value['alamat_perusahaan'] ?></textarea></td>
                                        </tr>
									
									

                                    <?
                                    if ($status == "edit") {
                                        echo '
                                            <tr>
                                            <td width="80">&nbsp;</td>
                                            <td width="208"> <img src='.$foto_santri.' width="150" height="150"></td>
                                            </tr>
											<tr>
                                            <td>Ganti foto</td>
                                            <td><input type="file" name="foto_santri" size="30"/></td>
                                            <td></td>
                                            </tr>
                                            
                                        ';
										// <tr>
                                            // <td>Ganti foto</td>
                                            // <td><input type="file" name="foto_santri" size="30"/></td>
                                            // <td></td>
                                            // </tr>
                                    } else {
                                        echo'
                                        <tr>
                                        <td>Foto</td>
                                        <td><input type="file" name="foto_santri" size="30"/></td>
                                        </tr>
                                        ';
                                    }
                                    ?>



                                    <tr>
                                        <td height="28">&nbsp;</td>
                                        <td>
                                            <div align="left">
                                                <input type="submit" name="Submit" value="Simpan" />
												<a href="<?php echo site_url('santri/index') ?>">
												<input type="button" value="Kembali" />
												</a>

												
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </form>
                        <p align="center">&nbsp;</p></td></tr>
            </table>
        </div>
        <p>&nbsp;</p>
		
		<script type="text/javascript">//<![CDATA[

      var cal = Calendar.setup({
          onSelect: function(cal) { cal.hide() }
      });
      cal.manageFields("f_btn1", "tanggal_lahir", "%Y-%m-%d");

    //]]></script>
		
    </fieldset>
</div>
<p>
    <!--container-->
</p>
<p>&nbsp; </p>

